package priv.pattern.Interpreterpattern.abs.impl;

import priv.pattern.Interpreterpattern.abs.Expression;

import java.util.HashMap;

/*
 * 作者：m鹏h
 * 时间；2024/8/11 12:44
 * 描述：减法解释器
 **/
public class SubExpression extends SymbolExpression {
 public SubExpression(Expression left, Expression right) {
  super(left, right);
 }

 //求出left与right表达式相减的结果
 public int interpreter(HashMap<String, Integer> var) {
  return super.left.interpreter(var) - super.right.interpreter(var);
 }
}
